// /*
//  * @Author: wanyiming
//  * @Date:2024-01-11-22:37
//  * @Description:
//  */

using QFramework;
using UnityEngine;

namespace Code.Utility
{
    public class UIUtility : IUtility
    {
        /**
         * 切换开关
         */
        public void SwitchingUI(GameObject gameObject, bool show)
        {
            CanvasGroup canvasGroup = gameObject.GetComponent<CanvasGroup>();
            if (canvasGroup == null) return;

            if (!show)
            {
                canvasGroup.alpha = 0;
                canvasGroup.interactable = false;
                canvasGroup.blocksRaycasts = false;
            }
            else
            {
                canvasGroup.alpha = 1;
                canvasGroup.interactable = false;
                canvasGroup.blocksRaycasts = false;
            }
        }


        /**
        * 切换开关
        */
        public void SwitchingUI(CanvasGroup canvasGroup, bool show)
        {
            if (canvasGroup == null) return;

            if (!show)
            {
                canvasGroup.alpha = 0;
                canvasGroup.interactable = false;
                canvasGroup.blocksRaycasts = false;
            }
            else
            {
                canvasGroup.alpha = 1;
                canvasGroup.interactable = false;
                canvasGroup.blocksRaycasts = false;
            }
        }
    }
}